<%@include file="/header/head.jsp" %>
<jsp:include page="/header/header.jsp">
	<jsp:param value="" name="title"/>
</jsp:include>


<!-- end of menu_wrapper -->
<div id="content">
<spring:url var = "action" value='/users/save'/>

<form:form commandName="entity" action="${action}" method="post" >
		<c:if test="${!entity.new}">
            <form:hidden path="id"/>
		</c:if>
		<table width="60%" border="1" cellspacing="0">
		
            <tr>
                <td><strong>User Name:</strong></td>
                <spring:bind path="userName">
	                <td>
	                	<c:if test="${status.error}">
						<c:out value="${status.errorMessage}"/>
						</c:if>
	                	<form:input path="userName"/>
	                </td>
	            </spring:bind>
            </tr>
            <c:if test="${entity.new}">
            <tr>
            	<td><strong>Password:</strong></td>
                <spring:bind path="password">
                <td>
                	<c:if test="${status.error}">
					<c:out value="${status.errorMessage}"/>
					</c:if>
                	<form:password path="password"/>
                </td>
                </spring:bind>
            </tr>
            </c:if>
            
            <tr>
                <td><strong>First Name:</strong></td>
                <td>
                	<form:input path="userDetail.firstName"/>
                </td>
            </tr>
            <tr>
                <td><strong>Last Name:</strong></td>
                <td>
                	<form:input path="userDetail.lastName"/>
                </td>
            </tr>
            <tr>
                <td><strong>Gender:</strong></td>
                <td>
                	Male: <form:radiobutton path="userDetail.gender" value="M"/> <br/>
			        Female: <form:radiobutton path="userDetail.gender" value="F"/>
                </td>
            </tr>
            
            <tr>
                <td><strong>Role Name:</strong></td>
                <td>
                	<spring:bind path="authorities">
                		<select name="${status.expression}">
					        <option value="-1">Select One</option>
					        <c:forEach var="authority" items="${authorities}">  
						          <option value="${authority.id}" 
						          <c:if test="${status.value == authority.id}">
						          		selected="selected"
						          </c:if> 
						          >
						          ${authority.roleName}
						          </option>
					        </c:forEach>  
					    </select>
                	</spring:bind>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td><input type="submit" name="submit" value="Submit"/></td>
            </tr>
        </table>
    </form:form>
</div>
 
 <%@include file="/footer/footer.jsp" %>